package cn.simon.config;

import org.springframework.amqp.core.Binding;
import org.springframework.amqp.core.BindingBuilder;
import org.springframework.amqp.core.Queue;
import org.springframework.amqp.core.TopicExchange;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.data.redis.listener.Topic;
/**
*
 * @功能描述： rabbitMq配置类-主题模式 - seckill
 * @Auther: simon-yi'an
 */

@Configuration
public class RabbitMqTopicSeckillConfig {
    private static final String QUEUE = "seckill_queue";
    private static final String TOPICEXCHANGE = "topicExchange";
    private static final String ROUTINGKEY = "seckill.#";
    @Bean
    public Queue seckill_queue(){
        return new Queue(QUEUE);
    }
    @Bean
    public TopicExchange topicExchange(){
        return new TopicExchange(TOPICEXCHANGE);
    }

    @Bean
    public Binding bindTopicExchange01(){
        return BindingBuilder.bind(seckill_queue()).to(topicExchange()).with(ROUTINGKEY);
    }
}
